package gui;

// Diva imports
import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.net.URL;

import javax.swing.KeyStroke;

import ptolemy.actor.gui.Configuration;
import ptolemy.kernel.util.IllegalActionException;
import ptolemy.kernel.util.NameDuplicationException;
import ptolemy.kernel.util.NamedObj;
import ptolemy.util.MessageHandler;
import ptolemy.vergil.kernel.AttributeController;
import ptolemy.vergil.toolbox.FigureAction;
import ptolemy.vergil.toolbox.MenuActionFactory;
import diva.graph.GraphController;
import diva.gui.GUIUtilities;

//////////////////////////////////////////////////////////////////////////
//// VerifierController
/**
    Xupadao do ptolemy.chic
*/
public class VerifierController extends AttributeController {

    public VerifierController(GraphController controller) {
        this(controller, FULL);
    }

    public VerifierController(GraphController controller, Access access) {
        super(controller, access);

        _access = access;

        // Add commands to invoke Chic
        _menuFactory.addMenuItemFactory(
                new MenuActionFactory(new VerifyMoCsAction()));
    }

    ///////////////////////////////////////////////////////////////////
    ////                         public methods                    ////

    public void setConfiguration(Configuration configuration) {
        super.setConfiguration(configuration);
    }

    ///////////////////////////////////////////////////////////////////
    ////                         protected variables               ////

    ///////////////////////////////////////////////////////////////////
    ////                         private variables                 ////

    private Access _access;

    ///////////////////////////////////////////////////////////////////
    ////                         inner classes                     ////

    private class VerifyMoCsAction extends FigureAction {
        
        public VerifyMoCsAction() {
            super("Apply Interaction Semantics");
        }
        
        public void actionPerformed(ActionEvent e) {
            super.actionPerformed(e);
            NamedObj object = getTarget();

            ((VerifierInvoker)object).analyseSpec();
            return;
        }
    }
}
